<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/12/20/020
 * Time: 17:58
 */

namespace app\portal\controller;


use app\api\model\VideoPostModel;
use cmf\controller\HomeBaseController;

class HvideoController extends HomeBaseController
{
    //更多视频
    public function index()
    {
        $videoModel = new VideoPostModel();
        $videoList = $videoModel
            ->where('delete_time','=',0)
            ->order('create_time','DESC')
            ->paginate(9);
        $page = $videoList->render();
        $this->assign('articleList',$videoList);
        $this->assign('page', $page);
        return $this->fetch(':videoList');
    }

    //视频详情
    public function videoDetail()
    {
        $videoId  = $this->request->param('id', 0, 'intval');
        if (empty($videoId)) {
            $this->error("参数有误！");
        }
        $videoModel = new VideoPostModel();
        $video = $videoModel
            ->where('id','=',$videoId)
            ->find();
        if ( empty($video) ) {
            $this->error("该已经删除！");
        }
        $this->assign('video',$video);
        return $this->fetch(':videoDetail');
    }
}